package a15_memo.black;

/**
 * 黑盒模式下，mgr才有存在的必要性</br>
 * 此模式下，备忘录对象能被保护起来
 * 
 * @author shaoyuxia
 *
 */
public class Client {
	public static void main(String[] args) {
		Caller caller = new Caller();
		caller.setState("0000");
		System.out.println("original state of caller is " + caller.getState());
		MemoMgr mgr = new MemoMgr();
		mgr.setMemo(caller.createMemo());
		caller.setState("1111");
		System.out.println("after first setState, state of caller is " + caller.getState());
		caller.restoreMemo(mgr.getMemo());
		System.out.println("after restore, state of caller is " + caller.getState());
	}
}
